package com.yzmdxt;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author 张桂州
 * @create 2017-07-20 16:53
 **/
@Service
public class DcService {

    @Autowired
    RestTemplate restTemplate;



    // @HystrixCommand注解来指定服务降级方法
    @HystrixCommand(fallbackMethod = "fallback")
    public String consumer(){
        return restTemplate.getForObject("http://eureka-client/dc",String.class);
    }

    public String fallback(){
        return "fallback";
    }
}
